package com.gzw.scm.utils;

import com.gzw.scm.bean.Info;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * Created by Administrator on 2018/2/26 0026.
 */

public class SortUtil {
    public static List<Info> numberSort(List<Info> infoList) {
        Collections.sort(infoList, new Comparator<Info>() {
            @Override
            public int compare(Info o1, Info o2) {
                if (o1.getTboxno().compareTo(o2.getTboxno()) < 0)
                    return 1;
                if (o1.getTboxno().compareTo(o2.getTboxno()) == 0)
                    return 0;
                return -1;
            }
        });
        return infoList;
    }

    public static List<Info> labelSort(List<Info> infoList) {
        Collections.sort(infoList, new Comparator<Info>() {
            @Override
            public int compare(Info o1, Info o2) {
                if (o1.getOrdnoid1().compareTo(o2.getOrdnoid1()) < 0)
                    return 1;
                if (o1.getOrdnoid1().compareTo(o2.getOrdnoid1()) == 0)
                    return 0;
                return -1;
            }
        });
        return infoList;
    }

    public static List<Info> orderSort(List<Info> infoList) {
        Collections.sort(infoList, new Comparator<Info>() {
            @Override
            public int compare(Info o1, Info o2) {
                if (o1.getWordernumber().compareTo(o2.getWordernumber()) < 0)
                    return 1;
                if (o1.getWordernumber().compareTo(o2.getWordernumber()) == 0)
                    return 0;
                return -1;
            }
        });
        return infoList;
    }

    public static List<Info> supplierSort(List<Info> infoList) {
        Collections.sort(infoList, new Comparator<Info>() {
            @Override
            public int compare(Info o1, Info o2) {
                if (o1.getSuppname().compareTo(o2.getSuppname()) < 0)
                    return 1;
                if (o1.getSuppname().compareTo(o2.getSuppname()) == 0)
                    return 0;
                return -1;
            }
        });
        return infoList;
    }

}
